from typing import List, Union
from pydantic import BaseModel, Field, root_validator
from ..common.sec_level import MailRoute
from ..common.trd_level import Aging, ValueAdded, RPSalePriceAdjust


# 返回可用邮路参数
class AvailableMailRoute(BaseModel):
    """
    在代码中拼接好数据
    """
    mail_route: MailRoute = Field(None, description='邮路')
    aging: Aging = Field(None, description='时效')
    tag_price: float = Field(None, description='标价')
    expect_arrive_date: str = Field(None, description='预计到达时间')
    sale_adjustment_price: float = Field(None, description='调后价')
    available_adjustment: List[int] = Field(..., description='可用调价')
    available_value_added: List[ValueAdded] = Field(None, description='可用增值')


# 返回选中邮路后，该邮路可用的增值服务和调后价

class AvailableValueAdded(BaseModel):
    """
    在代码中拼接数据
    """
    valued_added_id: ValueAdded = Field(None, description='增值服务')
    value_added_type: str = Field(..., description='增值服务类型')
    value_added_category: str = Field(..., description='增值服务等级')
    tag_price: str = Field(..., description='标价')
    adjusted_price: str = Field(..., description='调后价')
    used_sale_price_adjust_ids: List[RPSalePriceAdjust] = Field(None, description='使用的调价')
